home *** CD-ROM | disk | FTP | other *** search
- Path: xanth!nic.MR.NET!hal!ncoast!allbery
- From: edf@ROCKY2.ROCKEFELLER.EDU (David MacKenzie)
- Newsgroups: comp.sources.misc
- Subject: v05i010: troff2lj-v2 htroff that downloads fonts
- Message-ID: <8810250510.AA28540@rocky2>
- Date: 28 Oct 88 02:33:57 GMT
- Sender: allbery@ncoast.UUCP
- Reply-To: edf@ROCKY2.ROCKEFELLER.EDU (David MacKenzie)
- Lines: 141
- Approved: allbery@ncoast.UUCP
-
- Posting-number: Volume 5, Issue 10
- Submitted-by: "David MacKenzie" <edf@ROCKY2.ROCKEFELLER.EDU>
- Archive-name: htroff2
-
- This can't hold a candle to JetRoff's automatic selective-downloading
- of fonts, but it's an improvement over the previous "htroff" script.
- It ensures that the downloaded fonts and the troff document are sent
- to the printer as the same print job (previously a problem on our system
- as other people were running programs that used the printer memory for
- graphics or just deleted all of the soft fonts for speed).
-
- I wrap "htroff" in an additional layer. I wrote one-lines scripts
- called "mstroff", "mantroff", "mmtroff" etc. that call htroff with the
- appropriate flags to use the appropriate macros and download the needed
- fonts, so I can just say "mmtroff foo.mm &" to format and print foo.mm
- on the LaserJet.
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of shell archive."
- # Contents: htroff.1 htroff
- # Wrapped by dave@edfdc on Tue Sep 20 02:18:58 1988
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'htroff.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'htroff.1'\"
- else
- echo shar: Extracting \"'htroff.1'\" \(815 characters\)
- sed "s/^X//" >'htroff.1' <<'END_OF_FILE'
- X.TH HTROFF 1
- X.SH NAME
- Xhtroff \- text formatter for HP LaserJet
- X.SH SYNOPSIS
- X.B htroff
- X[
- X.B \-options
- X] [
- X.B files
- X]
- X.SH DESCRIPTION
- X.I Htroff
- Xis a front end for the troff(1) text formatting program. It sends its
- Xoutput to a Hewlett-Packard LaserJet or compatible printer. In addition
- Xto all of the standard troff options,
- X.I htroff
- Xalso accepts arguments of the form
- X.I \-nXX,
- Xwhich indicate that the font with name
- X.I XX
- Xis to be mounted on font position
- X.I n
- X(1 <=
- X.I n
- X<= 3). Fonts 1-3 default to "R", "I", and "B", (Times Roman, Times
- XBold, and Times Italic) respectively.
- X.PP
- XAlso, arguments of the form
- X.I \-dfontfile
- Xare accepted, and cause the named
- X.I fontfile
- Xto be downloaded to the printer before the text is printed.
- X.SH "SEE ALSO"
- Xdownload(1), troff(1)
- X.SH AUTHORS
- XSverre Froyen, David MacKenzie
- END_OF_FILE
- if test 815 -ne `wc -c <'htroff.1'`; then
- echo shar: \"'htroff.1'\" unpacked with wrong size!
- fi
- # end of 'htroff.1'
- fi
- if test -f 'htroff' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'htroff'\"
- else
- echo shar: Extracting \"'htroff'\" \(1117 characters\)
- sed "s/^X//" >'htroff' <<'END_OF_FILE'
- X:
- X# htroff - troff for HP LaserJet
- X# Usage: htroff [-options] [files]
- X#
- X# Special options:
- X# -nXX mount font XX on position n (n = 1-3)
- X# -dYY download font YY
- X#
- X# Sends its output to the LaserJet automatically.
- X# Latest revision: 07/26/88
- X
- Xtranslate=troff2lj
- X#translate=/usr/local/lib/troff2lj
- Xprintcmd='lpr -plaserjet'
- X#printcmd='uux -n - "sst!/usr/ucb/lpr -Prhp"'
- Xdownload= # null to start out with
- Xdfiles=
- X
- Xoptions=-t # Send output to stdout instead of /dev/cat.
- Xljopts=
- Xfiles=
- Xfont1=R
- Xfont2=I
- Xfont3=B
- X
- Xfor arg
- Xdo
- X case $arg in
- X -) files="$files $arg" ;;
- X -d*) download="download -d";
- X dfiles="$dfiles `echo $arg|sed 's/-d//'`" ;;
- X -1*) font1=`echo $arg|sed 's/-1//'`; ljopts="$ljopts $arg" ;;
- X -2*) font2=`echo $arg|sed 's/-2//'`; ljopts="$ljopts $arg" ;;
- X -3*) font3=`echo $arg|sed 's/-3//'`; ljopts="$ljopts $arg" ;;
- X -[4-9]*|-0*) echo "Illegal font mount: $arg" >&2; exit 1 ;;
- X -*) options="$options $arg" ;;
- X *) files="$files $arg" ;;
- X esac
- Xdone
- X
- X{
- X$download $dfiles
- X{
- Xecho "\
- X.fp 1 $font1
- X.fp 2 $font2
- X.fp 3 $font3
- X.fp 4 S
- X.lg 0"
- X
- Xcat $files
- X} | troff $options | $translate $ljopts
- X} | $printcmd
- END_OF_FILE
- if test 1117 -ne `wc -c <'htroff'`; then
- echo shar: \"'htroff'\" unpacked with wrong size!
- fi
- chmod +x 'htroff'
- # end of 'htroff'
- fi
- echo shar: End of shell archive.
- exit 0
-